package com.feicheng.house.wcpay.controller;



import com.feicheng.house.exception.SystemException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.house.result.ResultInfo;
import com.feicheng.house.wcpay.service.UserAuthorizationService;
@RestController
@RequestMapping("/house/UserAuthorizationController")
public class UserAuthorizationController {
	@Autowired
	private UserAuthorizationService userAuthorizationService;
	@PostMapping("/code")
	public ResultInfo getopenid(String code, String state) throws SystemException {
		 if(code == null){
	            throw new SystemException("用户微信登录的授权码code获取失败");
	        }
	        return userAuthorizationService.getOpenId(code, state);
	}

}
